[No QA] fix: include env variables in Rock's fingerprint#73632
Conversation
| android: platformAndroid({sourceDir: isHybrid ? './Mobile-Expensify/Android' : './android'}), | ||
| }, | ||
| fingerprint: { | ||
| env: ['USE_NGROK', 'NGROK_URL', 'SECURE_NGROK_URL'], |
There was a problem hiding this comment.
Can we just include the whole .env file? There are lots of variables in there and I don't think we want to maintain a list of variables that can effect this.
There was a problem hiding this comment.
I'd say we shouldn't. Most of these variables do not take part in the build process (are JS only) and this is pretty much what a @latest tag is. Instead, we should list out which of these are actually baked in and thus problematic (ngrok vars are) - this makes it far easier to maintain (they likely won't change) and debug.
There was a problem hiding this comment.
I thought that all variables in .env ended up in native?
There was a problem hiding this comment.
Also, just for reference, all these variables occasionally will change and I don't think anyone will check them or know that rock is caching them
There was a problem hiding this comment.
Yup .env I think ends up baked in thanks to react-native-config, but there's no .env on the CI and Rock does not auto-inject entire env.process into the hashing mechanism to keep it predictable. Do you think we should read .env in the config file and spread all its values into this array?
There was a problem hiding this comment.
Yes, I think that solution will be more reliable, even if we have a few more local builds. I think that's a fine trade off.
There was a problem hiding this comment.
Busy with Sentry investigations today, I'll update the PR on tomorrow 👍🏻
There was a problem hiding this comment.
Updated the PR, curious how it'll work tbh. It behaves ok on my end, but I don't deal with lots of them specified locally. We just have to be aware that in order to hit the remove cache, developer would have to completely comment out custom variables specified in .env.
There was a problem hiding this comment.
I'm onboard with this change. Yes it will result in fewer build cache hits, but as long as they're still compiled into the native code, their values affect its behavior. I prefer correctness over speed here for sure!
Just tested it and it works great, though I will say I'm not sure why you'd ever have a GITHUB_TOKEN in your App .env
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/chuckdries in version: 9.2.58-0 🚀
|
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.2.58-3 🚀
|
@chuckdries @AndrewGable
Explanation of Change
This PR includes all custom env variables defined using
.envin Rock's fingerprinting mechanism.Fixed Issues
$
PROPOSAL: https://expensify.slack.com/archives/C08CZDJFJ77/p1760640153256349
Tests
I tested this against different matrix combinations of custom variables and can confirm it is producing unique hashes for each of them. It's up to a developer to comment out custom values when working locally to hit remote builds' cache (CI runs with 0 custom values).
Offline tests
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop